#include "Player.h"

Player::Player(glm::vec3 position) : GameObject("player", position), hud(NULL), maxSpeed(50.0f) {
    setColorMap(Texture::load("game/assets/textures/spaceship.jpg"));
    setMesh(Mesh::load("game/assets/models/spaceship.obj"));

    setBehaviour(new PlayerBehaviour(this));
    setCollider(new SphereCollider(this, getMesh()->computeRadius()));
}

Player::~Player() {
    //dtor
}

void Player::accept(Visitor* visitor) {
    visitor->visit(this);
}

Hud* Player::getHud() {
    return hud;
}

void Player::setHud(Hud* hud) {
    this->hud = hud;
}

float Player::getSpeed() {
    return speed;
}

void Player::changeSpeed(float change) {
    speed += change;

    if(speed > maxSpeed) {
        speed = maxSpeed;
    } else if(speed < -maxSpeed) {
        speed = -maxSpeed;
    }
}
